import request from '@/config/axios'

// 平台协议 VO
export interface AgreementVO {
  id: number // 编号
  type: string // 协议类型
  title: string // 协议名称
  contentType: boolean // 内容类型1在线2附件
  content: string // 协议内容
  file: string // 协议附件
  sort: number // 排序
}

// 平台协议 API
export const AgreementApi = {
  // 查询平台协议分页
  getAgreementPage: async (params: any) => {
    return await request.get({ url: `/system/agreement/page`, params })
  },

  // 查询平台协议详情
  getAgreement: async (id: number) => {
    return await request.get({ url: `/system/agreement/get?id=` + id })
  },

  // 新增平台协议
  createAgreement: async (data: AgreementVO) => {
    return await request.post({ url: `/system/agreement/create`, data })
  },

  // 修改平台协议
  updateAgreement: async (data: AgreementVO) => {
    return await request.put({ url: `/system/agreement/update`, data })
  },

  // 删除平台协议
  deleteAgreement: async (id: number) => {
    return await request.delete({ url: `/system/agreement/delete?id=` + id })
  },

  // 导出平台协议 Excel
  exportAgreement: async (params) => {
    return await request.download({ url: `/system/agreement/export-excel`, params })
  },
}